package cw.spring.security.acl.poc.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@Entity
@Table(name = "Deal", uniqueConstraints = { @UniqueConstraint(columnNames = { "id" }) })
public class DealModel {

  private long id;
  private String name;
  private TraderModel trader;
  private BookModel book;

  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  public long getId() {
    return id;
  }

  public void setId(long id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  @ManyToOne
  @JoinColumn(name = "trader_id", nullable = false)
  public TraderModel getTrader() {
    return trader;
  }

  public void setTrader(TraderModel trader) {
    this.trader = trader;
  }

  @ManyToOne
  @JoinColumn(name = "book_id", nullable = false)
  public BookModel getBook() {
    return book;
  }

  public void setBook(BookModel book) {
    this.book = book;
  }

}
